package com.dkakunsi.monev.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="REALISASI_DANA")
public class RealisasiDana {
	private int id;
	private Kegiatan kegiatan;
	private int bulan;
	private long jumlah;
	
	public RealisasiDana() { }
	
	public RealisasiDana(Kegiatan kegiatan, int bulan, long jumlah) {
		setKegiatan(kegiatan);
		setBulan(bulan);
		setJumlah(jumlah);
	}

	@Id @GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="id", length=11, nullable=false)
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="kegiatan", nullable=false)
	public Kegiatan getKegiatan() {
		return kegiatan;
	}

	public void setKegiatan(Kegiatan kegiatan) {
		this.kegiatan = kegiatan;
	}

	@Column(name="bulan", length=2, nullable=false)
	public int getBulan() {
		return bulan;
	}

	public void setBulan(int bulan) {
		this.bulan = bulan;
	}

	@Column(name="jumlah", nullable=false)
	public long getJumlah() {
		return jumlah;
	}

	public void setJumlah(long jumlah) {
		this.jumlah = jumlah;
	}
}
